<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>关键词回复</title>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">
    <%@include file="../include/commonFile.jsp" %>
</head><body>
<!--头部-->
<%@include file="../include/header.jsp" %>
<div class="index-outside">
    <%@include file="../include/sidebar.jsp" %>
    <!--内容-->
    <section>
        <div class="section-main">
            <div class="layui-tab-item layui-show">
                <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                    <ul class="layui-tab-title" id="zc_tab">
                        <li class="layui-this">设置关键词</li>
                        <%--<li>触发关键词数据</li>--%>
                    </ul>
                </div>
                <div class="layui-tab-content">
                    <form class="layui-form" action="${ctx}/wechat/keywordresponse/view.do" id="myForm" method="get">
                        <input type="hidden" name="pageNo" id="pageNo"/>
                        <input type="hidden" name="type" id="type" value="3"/>
                        <div class="f-search-bar">
                            <div class="search-container">
                                <ul class="search-form-content">
                                    <li class="form-item-inline"><label class="search-form-lable">关键词</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="key" autocomplete="off" class="layui-input"
                                                   value="${key}"
                                                   placeholder="请输入关键词">
                                        </div>
                                    </li>
                                    <li class="form-item-inline">
                                        <div class="sub-btns">
                                            <a class="layui-btn layui-btn-danger"
                                               href="javascript:submitFunction('#myForm')">查询</a>
                                            <a class="layui-btn layui-btn-normal"
                                               href="javascript:resetFunction('#myForm')">重置</a>
                                        </div>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </form>
                    <div class="c-time-list-content">
                        <div class="list-content">
                            <div class="cl">
                                <table class="layui-table">
                                    <colgroup>
                                        <col width="100">
                                        <col width="100">
                                        <col width="100">
                                    </colgroup>
                                    <thead>
                                    <tr>
                                        <th>关键词</th>
                                        <th>回复内容</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <c:forEach var="response" items="${responses}">
                                        <tr>
                                            <td class="">
                                                <div class="dib ellipsis-1"
                                                     title="${response.key}">${response.key}</div>
                                            </td>
                                            <td>
                                                    ${response.content}
                                            </td>

                                            <td class="tb-opts">
                                                <div class="comm-opts">
                                                    <a href="${ctx}/wechat/keywordresponse/keywordform.do?id=${response.id}"
                                                       target="_self">
                                                        编辑
                                                    </a>
                                                </div>
                                                <div class="comm-opts">
                                                    <a href="javascript:txz.deleteObject('确定要删除该主题？','${ctx}/wechat/keywordresponse/delete.do?id=${response.id}')"
                                                       target="_self">
                                                        删除
                                                    </a>
                                                </div>
                                            </td>
                                        </tr>
                                    </c:forEach>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div id="page_content" class="page-container"></div>
                    </div>
                </div>
            </div>
        </div><!--底部-->
        <%@include file="../include/footer.jsp" %>
    </section>
</div>

<script type="text/javascript" src="${ctx}/script/common/table_option.js"></script>
<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript">

    $(function () {
        // 加载分页
        loadPageNew({elem: 'page_content',totalCount: '${page.totalCount}',limit: '${page.limit}',page: '${page.page}'});
        layui.use(['laytpl', 'laypage', 'element'], function () {
//            laytpl = layui.laytpl;
//            laypage = layui.laypage;
            element = layui.element;


//            element.on('tab(type)', function (data) {
//                if (data.index == 0) {
//                    $('#status').val(0);
//                    $('#myForm').submit();
//                }
//                else if (data.index == 1) {
//                    $('#status').val(1);
//                    $('#myForm').submit();
//                }
//            });
//          暂时不要删除
            <%--element.on('tab', function (data) {--%>
                <%--if (data.index == 0) {--%>
                    <%--location.href = "${ctx}/wechat/keywordresponse/view.do";--%>
                <%--} else if (data.index == 1) {--%>
                    <%--location.href = "${ctx}/wechat/keywordresponse/data.do";--%>
                <%--}--%>
            <%--});--%>
        });
    })
</script>
<script type="text/javascript">
    txz.initHeader({
        nav:[{
            name: '关键词回复',
            curr: true
        }],
        btns:[{
            name: '添加关键词回复',
            icon: 'add',
            href: '${ctx}/wechat/keywordresponse/keywordform.do'
        }]
    });
</script>
</body>
</html>